<!DOCTYPE HTML>
<html>

	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="HandheldFriendly" content="true" />
		<meta name="MobileOptimized" content="320" />
		<link href="../mui/css/mui.min.css" rel="stylesheet" />
		<link href="../styles/default.css" rel="stylesheet" />
		<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
		<link href="./css/mui.min.css" rel="stylesheet" />
		<link href="../mui/css/mui.indexedlist.css" rel="stylesheet" />
		<title>地图</title>
		<style type="text/css">
			#map {
				width: 100%;
				position: fixed;
				top: 10.9rem;
				bottom: 0;
				line-height: 20rem;
				text-align: center;
				background: #fff;
			}
			
			.ipos {
				background: no-repeat center center url();
				background-size: 5rem 4.4rem;
			}
			
			header {
				background: transparent;
			}
			
			.mui-title {
				font-size: 1.8rem;
			}
			
			body {
				line-height: 1;
			}
			
			.mui-bar {
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding-left: 1.2rem;
				height: 6.4rem;
			}
			
			.mui-indexed-list {
				width: 78%;
				border-radius: 0.5rem;
				border: none;
			}
			
			.mui-indexed-list-search {
				border: none;
			}
			
			.mui-bar input[type=search] {
				margin: 0;
				padding: 0;
				display: inherit;
			}
			
			.mui-bar .mui-icon {
				padding: 0;
			}
			
			.mui-search .mui-placeholder {
				height: 3rem;
				font-size: 1rem;
				line-height: 3rem;
			}
			
			.mui-search .mui-placeholder .mui-icon {
				font-size: 1.6rem;
				margin: 0;
			}
			
			.mui-bar .mui-input-row .mui-input-clear~.mui-icon-clear {
				top: 0.5rem;
			}
			
			.mui-bar-nav.mui-bar .mui-icon {
				padding-right: 0.5rem;
				padding-left: 0.5rem;
			}
			
			/* 筛选--开始 */
			.hotel-footer {
				position: absolute;
				border: none;
				background-color: #f0f0f0;
				top: 6.4rem;
				height: 4.5rem;
			}
			
			.hotel-footer-menu {
				display: flex;
				text-align: center;
			}
			
			.hotel-footer-menu li {
				font-size: 1.2rem;
				height: 4.5rem;
				line-height: 4.5rem;
				padding: 0;
			}
			
			.option-item {
				position: relative;
				color: #999;
				padding: 1.5rem 0;
			}
			
			.option-item:after {
				position: absolute;
				content: '';
				width: 0.4rem;
				height: 0.6rem;
				right: -1.2rem;
				bottom: 2.2rem;
				background-image: url(../styles/images/list/icon_direction_selected_gray.png@2x.png);
				background-size: 0.4rem 0.6rem;
			}
			
			.default:after {
				position: absolute;
				content: '';
				width: 0.4rem;
				height: 0.6rem;
				right: -1.2rem;
				bottom: 2.2rem;
				background-image: url(../styles/images/list/icon_direction_selected.png@2x.png);
				background-size: 0.4rem 0.6rem;
			}
			
			.option-item.active {
				color: #e61874;
			}
			
			.option-item.active:after {
				position: absolute;
				content: '';
				width: 0.6rem;
				height: 0.4rem;
				right: -1.2rem;
				bottom: 2.2rem;
				background-image: url(../styles/images/list/icon_direction_down.png@2x.png);
				background-size: 0.6rem 0.4rem;
			}
			
			.recommend-box,
			.price-box,
			.filter-box {
				position: absolute;
				top: 4.5rem;
				left: 0;
				width: 100%;
				max-height: 30rem;
				overflow-y: auto;
				padding: 2.4rem 1.2rem 0.3rem 1.2rem;
				background-color: #fff;
			}
			/* 推荐排序--开始 */
			
			.recommend-item {
				font-size: 1.4rem;
				color: #666;
				padding-left: 2.1rem;
				padding-bottom: 2.1rem;
			}
			
			.recommend-item:last-child {
				padding-bottom: 1.2rem;
			}
			
			.recommend-item.active {
				position: relative;
				color: #e61374;
			}
			
			.recommend-item.active:before {
				display: inline-block;
				position: absolute;
				left: 0;
				top: 0.4rem;
				width: 1.2rem;
				height: 0.8rem;
				content: '';
				background-image: url(../styles/images/list/icon_ensure_nor.png@2x.png);
				background-size: 1.2rem 0.8rem;
			}
			/*.recommend-item span {
				font-size: 0.7rem;
				color: #666;
				padding-left: 1.05rem;
			}*/
			/*.recommend-item span.active {
				position: relative;
				color: #e61374;
			}*/
			
			.recommend-item span.active:before {
				display: inline-block;
				position: absolute;
				left: 0;
				top: 0.4rem;
				width: 1.2rem;
				height: 0.8rem;
				content: '';
				background-image: url(../styles/images/list/icon_ensure_nor.png@2x.png);
				background-size: 1.2rem 0.8rem;
			}
			/* 推荐排序--结束 */
			/* 刷选项--开始 */
			
			.mui-input-row.mui-input-range {
				padding-right: 1.2rem;
				padding-bottom: 1.8rem;
			}
			
			.list-box:last-child .filter-tag {
				margin-bottom: 0;
			}
			
			.price-box p,
			.filter-box p {
				display: inline-block;
				width: 100%;
				font-size: 1.2rem;
				color: #999;
				padding-left: 0.9rem;
				margin-bottom: 0;
			}
			
			.price-tag,
			.filter-tag {
				height: 3rem;
				margin: 1.2rem 0 1.5rem;
			}
			
			.price-tag li,
			.filter-tag li {
				float: left;
				height: 3rem;
				line-height: 2.8rem;
				font-size: 1.2rem;
				color: #333;
				text-align: center;
				border: 1px solid #999;
				border-radius: 1.45rem;
				margin-right: 0.9rem;
				margin-bottom: 1.2rem;
				padding: 0 0.6rem;
			}
			
			.filter-tag li {
				min-width: 22.5%;
			}
			
			.filter-tag li:nth-child(4n) {
				margin-right: 0;
			}
			
			.boxview {
				background: rgba(0, 0, 0, 1);
				height: 100%;
				width: 100%;
			}
			
			.price-tag li {
				min-width: 30%;
				margin-right: 1.3rem;
			}
			
			.price-tag li:nth-child(3n) {
				margin-right: 0;
			}
			
			li.default {
				color: #E61874;
				border-color: #e61874;
			}
			/* 筛选项--结束 */
			/* 筛选--结束 */
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav hotel-header">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<div id='list' class="mui-indexed-list">
				<div class="mui-indexed-list-search mui-input-row mui-search">
					<input type="search" class="mui-input-clear mui-indexed-list-search-input" placeholder="酒店名、地名">
				</div>
			</div>
			<a class="mui-icon mui-pull-right" style="font-size: 1.6rem;" data-url="./hotel-list2.html">
				<img width="44" style="vertical-align: middle;" src="../styles/images/list/icon_list_nor.png@2x.png">
			</a>
			<footer class="hotel-footer">
				<div id="f-tit" class="f-tit">
					<ul class="hotel-footer-menu hotel-footer-menu-c4" id="optionul">
						<li class="option" id="recommend">
							<a class="option-item default" href="#" style="color: #e61874;">推荐排序</a>
						</li>
						<li class="option" id="price">
							<a class="option-item" href="#">价格/星级</a>
						</li>
						<li class="option" id="position">
							<a class="option-item" href="#">位置区域</a>
						</li>
						<li class="option" id="filter">
							<a class="option-item" href="#">筛选</a>
						</li>
					</ul>
				</div>
				<div id="f-con" class="f-con">
					<!--推荐排序-->
					<div class="con-box recommend-box hidden">
						<ul>
							<li class="recommend-item active">
								推荐排序
							</li>
							<li class="recommend-item">
								距离优先
							</li>
							<li class="recommend-item">
								低价优先
							</li>
							<li class="recommend-item">
								高价优先
							</li>
							<li class="recommend-item">
								好评优先
							</li>
						</ul>
					</div>
					<!--星级筛选-->
					<div class="con-box price-box hidden">
						<div class="list-box">
							<p>星级筛选</p>
							<ul class="price-tag">
								<li>经济型</li>
								<li>二星</li>
								<li>三星/舒适</li>
								<li>四星/高档</li>
								<li>五星/豪华</li>
								<li class="default">不限</li>
							</ul>
						</div>
						<div class="list-box">
							<p>价格筛选：<span id='block-range-val'>0</span></p>
							<div class="mui-input-row mui-input-range">
								<input type="range" id='block-range' value="0" min="0" max="1000">
							</div>
						</div>
					</div>
					<!--位置区域-->
					<div class="con-box position-box hidden">
						<div class="mui-row mui-fullscreen" style="height: 30rem;background: #FFFFFF;top:4.5rem;z-index: 10;">
							<div class="mui-col-xs-3">
								<div id="segmentedControls" class="mui-segmented-control mui-segmented-control-inverted mui-segmented-control-vertical">
								</div>
							</div>
							<div id="segmentedControlContents" class="mui-col-xs-9" style="border-left: 1px solid #c8c7cc;">
							</div>
						</div>
					</div>
					<!--筛选-->
					<div class="con-box filter-box hidden">
						<div>
							<div class="list-box">
								<p>特色专题</p>
								<ul class="filter-tag">
									<li>火辣</li>
									<li>烂漫</li>
									<li>纯情</li>
									<li>情趣</li>
								</ul>
							</div>
							<div class="list-box">
								<p>评分</p>
								<ul class="filter-tag">
									<li>4.5分以上</li>
									<li>4分以上</li>
									<li>3.5分以上</li>
									<li>3分以上</li>
								</ul>
							</div>
							<div class="list-box">
								<p>设施服务</p>
								<ul class="filter-tag">
									<li>情趣用品</li>
									<li>免费wifi</li>
									<li>停车场</li>
								</ul>
							</div>
							<div class="list-box">
								<p>舒适性</p>
								<ul class="filter-tag">
									<li>锦江之星品尚酒店</li>
									<li>一品公寓</li>
								</ul>
							</div>
							<div class="list-box">
								<p>高档型</p>
								<ul class="filter-tag">
									<li>新桃园</li>
								</ul>
							</div>
							<div class="list-box">
								<p>闪住</p>
								<ul class="filter-tag">
									<li>闪住</li>
								</ul>
							</div>
						</div>
					</div>
				</div>
			</footer>
		</header>
		<div id="map">地图加载中...</div>
		<div class="baidumap">
			<div class="nvbt ipos" onclick="userLocation();"></div>
		</div>
	</body>
	<script src="js/jquery-2.1.1.js"></script>
	<script src="../mui/js/mui.min.js"></script>
	<script type="text/javascript" src="../js/common.js"></script>
	<script type="text/javascript" src="../js/immersed.js"></script>
	<script src="../mui/js/mui.min.js"></script>
	<script type="text/javascript" src="../js/immersed.js"></script>
	<script src="../libs/ems.js" data-main='./city.js'></script>
	<script type="text/javascript">
		// 筛选栏的展示和隐藏
		var $option = $(".option");
		var $optionITem = $(".optionITem");
		var $conBox = $(".con-box");
		var index = 0;

		$option.click(function(e){
			$(this).children().toggleClass("active");
			$(this).siblings().children().removeClass("active");
			var index = $option.index(this);
			$conBox.eq(index).slideToggle().siblings().css("display", "none");
		});
		
		
		var ws = null,
			wo = null;
		var em = null,
			map = null,
			pcenter = null;
		// H5 plus事件处理
		function plusReady() {
			if(!em || ws) {
				return
			};
			// 获取窗口对象
			ws = plus.webview.currentWebview();
			wo = ws.opener();
			//高德地图坐标为(116.3974357341,39.9085574220), 百度地图坐标为(116.3975,39.9074)
			pcenter = new plus.maps.Point(114.078595, 22.542077);
			setTimeout(function() {
				map = new plus.maps.Map("map");
				map.centerAndZoom(pcenter, 12);
				createMarker();
				// 创建子窗口
				createSubview();
				userLocation();
			}, 300);
			// 显示页面并关闭等待框
			ws.show("pop-in");
		}
		if(window.plus) {
			plusReady();
		} else {
			document.addEventListener("plusready", plusReady, false);
		}
		// DOMContentloaded事件处理
		document.addEventListener("DOMContentLoaded", function() {
			em = document.getElementById("map");
			window.plus && plusReady();
		}, false);

		function userLocation() {
			map.showUserLocation(true);
			map.getUserLocation(function(state, pos) {
				if(0 == state) {
					map.setCenter(pos);
				}
				var searchObj = new plus.maps.Search(map);
				searchObj.onRouteSearchComplete = function(state, result) {
					console.log("onRouteSearchComplete: " + state + " , " + result.routeNumber);
					if(state == 0) {
						if(result.routeNumber <= 0) {
							alert("没有检索到结果");
						}
						map.addOverlay(result.getRoute(0));
						for(var i = 0; i < result.routeNumber; i++) {

						}

					} else {
						alert("检索失败");
					}
				}
				searchObj.drivingSearch(pos, "深圳", pcenter, "深圳");
			});
		}

		function createMarker() {
			//高德地图坐标为(116.3406445236,39.9630878208), 百度地图坐标为(116.347292,39.968716
			var marker = new plus.maps.Marker(new plus.maps.Point(114.078595, 22.542077));
			marker.setIcon("../styles/images/list/icon_hotellocation.png@2x.png");
			marker.setLabel("深圳上品酒店（会展中心店）");
			var bubble = new plus.maps.Bubble("这是一家专注情趣的酒店");
			marker.setBubble(bubble);
			map.addOverlay(marker);
		}

		function createSubview() {
			// 创建加载内容窗口
			var topoffset = '114px';
			if(plus.navigator.isImmersedStatusbar()) { // 兼容immersed状态栏模式
				topoffset = (Math.round(plus.navigator.getStatusbarHeight()) + 114) + 'px';
			}
			var wsub = plus.webview.create('maps_map_sub.html', 'sub', {
				top: topoffset,
				height: '100px',
				position: 'absolute',
				scrollIndicator: 'none',
				background: 'transparent'
			});
			ws.append(wsub);
		}

		function resetMap() {
			//map.centerAndZoom(pcenter,12);
			map.reset();
		}
	</script>

</html>